package com.hqyj.cloudTest.service.impl;


import com.hqyj.cloudTest.dao.CountryDao;
import com.hqyj.cloudTest.service.CountryService;
import com.hqyj.entity.Test.Country;
import com.hqyj.entity.common.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * personal demo
 **/

@Service
public class CountryServiceImpl implements CountryService {

    @Autowired
    private CountryDao countryDao;

    @Override
    @Transactional
    public Result<Country> getCountryById(int Id) {

        Country country = countryDao.getCountryById(Id);
        if(country==null){
            return new Result<>(Result.ResultStatus.FAILED.code,"can't find this country");
        }
        return new Result<>(Result.ResultStatus.SUCCESS.code,"yes",country);
    }
}
